<?
require_once("RedditApiBase.php");
require_once("EndpointRetriever/ObjectEndpointRetriever.php");
require_once("Endpoint.php");
class RedditApi extends RedditApiBase
{
	public function RedditApi()
	{
		$args = func_get_args();
		//ctor()
		if (count($args) == 0)
		{
			parent::RedditApiBase(
				new ObjectEndpointRetriever(
					new HttpEndpointRetriever(
						new UrlEndpointRetriever("www.reddit.com", "json"))));
		}
		//ctor(url, extension)
		else if (count($args) == 2 && is_string($args[0]) && is_string($args[1]))
		{
			parent::RedditApiBase(
				new HttpEndpointRetriever(
					new UrlEndpointRetriever($args[0], $args[1])));
		}
		//ctor(url)
		else if (count($args) == 1 && is_string($args[0]))
		{
			parent::RedditApiBase(
				new ObjectEndpointRetriever(
					new HttpEndpointRetriever(
						new UrlEndpointRetriever($args[0], "json"))));
		}
		//ctor(endpointRetriever)
		else if (count($args) == 1 && $args[0] instanceof IEndpointRetriever)
		{
			parent::RedditApiBase($args[0]);
		}
		//ctor(wtf)
		else
		{
			throw new Exception("Unknown arguments to constructor");
		}
	}
}
?>
